const main_content = document.getElementById('main-content');


let write_char_element, write_char_text, write_char_timeout;
function write_char() {
    write_char_element.innerText += write_char_text[0];
    write_char_text = write_char_text.substring(1);
    if (write_char_text.length) {
        setTimeout('write_char();', write_char_timeout);
    }
}


let quote = document.createElement('p');
main_content.append(quote);
let quote_content = document.createElement('em');
quote.append(quote_content);

function write_quote_1() {
    write_char_element = quote_content;
    write_char_text = '“人毋惧老。”';
    write_char_timeout = 100;
    write_char();
}

function write_quote_2() {
        quote_content.innerHTML += '<br>';
        write_char_text = '——佬';
        write_char();
    }

function write_quote() { // 2s
    setTimeout('write_quote_1();', 0);
    setTimeout('write_quote_2();', 1000);
}


function run() {
    setTimeout('write_quote();', 0);
}

setTimeout('run();', 0); // 3s